% v1
% function[ordering_list]=ordering(grpsize)%the grp the agent belongs
%    ordering_list={};
%    ngrp=length(grpsize);
%    parfor g=1:ngrp
%        [comb,lower]=agent_ordering(g,grpsize);
%        ordering_list{g}={comb,lower};
%    end
% end

%v2: use v3 of agent_ordering
function[ordering_list]=ordering(grpsize,grpk)%the grp the agent belongs
   ordering_list={};
   ngrp=length(grpsize);
   parfor g=1:ngrp
       [comb,lower,q_agent,numberpossibilities]=agent_ordering(g,grpsize,grpk);
       ordering_list{g}={comb,lower,q_agent,numberpossibilities};
   end
end